import sequelize from "../../db/dbConnext";
import { option } from "../../db/commomConfig";
import { DataTypes } from "sequelize";

import SysMenuEntity from "../../../entities/system/SysMenuEntity";
export type ISysUser = Omit<SysMenuEntity, "validateThis">;

const SysMenuModel = sequelize.define<any, ISysUser>(
  "sys_menu",
  {
    menuName: {
      type: DataTypes.STRING,
      allowNull: true,
      comment: "菜单名称",
    },
    parentId: {
      type: DataTypes.INTEGER,
      allowNull: true,
      comment: "上级菜单id",
    },
    orderNum: {
      type: DataTypes.INTEGER,
      allowNull: false,
      comment: "排序",
    },
    path: {
      type: DataTypes.STRING,
      allowNull: true,
      comment: "路由地址",
    },
    component: {
      type: DataTypes.STRING,
      allowNull: true,
      comment: "组件路径",
    },
    query: {
      type: DataTypes.STRING,
      allowNull: true,
      comment: "路由参数",
    },
    isFrame: {
      type: DataTypes.STRING,
      allowNull: true,
      comment: "是否为外部链接",
    },
    isCache: {
      type: DataTypes.STRING,
      allowNull: true,
      comment: "是否缓存",
    },
    menuType: {
      type: DataTypes.STRING,
      allowNull: true,
      comment: "菜单类型",
    },
    visible: {
      type: DataTypes.STRING,
      allowNull: true,
      comment: "是否可见",
    },
    status: {
      type: DataTypes.STRING,
      allowNull: false,
      comment: "是否启用",
    },
    perms: {
      type: DataTypes.STRING,
      allowNull: true,
      comment: "权限字符串",
    },
    icon: {
      type: DataTypes.STRING,
      allowNull: true,
      comment: "图标",
    },
  },
  option
);
export default SysMenuModel;
